#!/bin/sh

if [ $# -ne 2 ]
then
	exit -1
fi

modprobe -r  bwrm_driver
modprobe bwrm_driver

id=0
for dev in `cat $1`
do
	sects=$(($2 * 1024 * 1024 * 2))
	echo "dmsetup create pd_$id --table \"0 $sects bwrm_pd $dev $id\""
	dmsetup create pd_$id --table "0 $sects bwrm_pd $dev $id"
	id=$(($id + 1))
done

